package edu.tjut.web;

import edu.tjut.service.BuyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BuyController {
	@Autowired
	BuyService buyService;
	
	@PostMapping("/buy/{customer_id}")
	public String buy(@PathVariable("customer_id") long customer_id, @RequestBody Long[] product_ids) {
		buyService.buy(customer_id, product_ids);
		return "购买成功";
	}
}
